package org.aplikator.client.shared.descriptor;

import org.aplikator.client.local.widgets.BinaryFieldWidget;
import org.aplikator.client.local.widgets.HasFields;

import com.google.gwt.user.client.ui.Widget;
import org.jboss.errai.common.client.api.annotations.Portable;

@SuppressWarnings("serial")
//@JsonTypeName("binary")
//@Portable
public class BinaryFieldDTO extends WidgetPropertyDTOBase implements RenderWidgetAware {

	public static final String TYPE_KEY = "binary";
	
    private String entityId;

    @SuppressWarnings("unused")
    public BinaryFieldDTO() {      //TODO custom marshaller
    }

    public BinaryFieldDTO(PropertyDTO property, EntityDTO entity) {
        super(property);
        this.entityId = entity.getId();
    }

    
    public String getEntityId() {
    	return this.entityId;
    }
    
    public void setEntityId(String entityId) {
		this.entityId = entityId;
	}
    @Override
    public Widget getWidget(HasFields form)  {
        BinaryFieldWidget field = new BinaryFieldWidget(property, this.entityId, getSize(), isEnabled());
        form.registerBinaryField(field);
        field.setHeight("100px");
        return field;
    }

}
